package com.celesea.workflow.core.vo;

import com.celesea.framework.util.DateUtil;
import com.celesea.framework.util.EnumUtil;
import com.celesea.workflow.core.entity.WorkflowInstance;
import com.celesea.workflow.core.entity.WorkflowStatus;

import java.io.Serializable;

/**
 * @author JackYuan
 * @create 2017-11-29 10:12
 */
public class WorkflowInstanceVo implements Serializable {

    protected String id;
    protected String summary;
    protected String lastTime;
    protected String workflowStatus;
    protected String activeNodeName;

    public WorkflowInstanceVo() {
    }

    public WorkflowInstanceVo(WorkflowInstance instance) {
        this.id = instance.getId();
        this.summary = instance.getSummary();
        this.lastTime = DateUtil.getTime(instance.getLastTime());
        this.workflowStatus = EnumUtil.getName(WorkflowStatus.values(), instance.getWorkflowStatus());
        this.activeNodeName = instance.getActiveNodeName();
    }

    public WorkflowInstanceVo(
            String id,
            String summary,
            String lastTime,
            String workflowStatus,
            String activeNodeName) {
        this.id = id;
        this.summary = summary;
        this.lastTime = lastTime;
        this.workflowStatus = workflowStatus;
        this.activeNodeName = activeNodeName;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public String getLastTime() {
        return lastTime;
    }

    public void setLastTime(String lastTime) {
        this.lastTime = lastTime;
    }

    public String getWorkflowStatus() {
        return workflowStatus;
    }

    public void setWorkflowStatus(String workflowStatus) {
        this.workflowStatus = workflowStatus;
    }

    public String getActiveNodeName() {
        return activeNodeName;
    }

    public void setActiveNodeName(String activeNodeName) {
        this.activeNodeName = activeNodeName;
    }
}
